package com.fr.report.web.ui.impl.page;

import com.fr.base.Inter;
import com.fr.base.core.util.TemplateUtils;
import com.fr.report.web.ui.Icon;
import com.fr.report.web.ui.IconManager;
import com.fr.report.web.ui.WebContentUtils;
import com.fr.web.Repository;

public final class Last extends TabRelatedToolBarButton
{
  public Last()
  {
    super(Inter.getLocText("ReportServerP-Last"), IconManager.LAST.getName());
  }

  protected String clickAction(Repository paramRepository)
  {
    return WebContentUtils.getLastPageAction(paramRepository);
  }

  protected String onContentPanelAfterLoad(Repository paramRepository)
  {
    return TemplateUtils.render("if(${CP}.rtype==='view'){this[${CP}.curLGP.currentPageIndex==${CP}.curLGP.reportTotalPage?'disable':'enable']();}else{this[${CP}.currentPageIndex==${CP}.reportTotalPage?'disable':'enable']();}", "CP", WebContentUtils.getContentPanel(paramRepository));
  }

  protected String onTabChange(Repository paramRepository)
  {
    return TemplateUtils.render("this[${CP}.lgps[arguments[1]].currentPageIndex==${CP}.lgps[arguments[1]].reportTotalPage?'disable':'enable']()", "CP", WebContentUtils.getContentPanel(paramRepository));
  }
}